﻿/************************************************************************
* Programmer: Brad Brundage
* Date: 9-23-2012
* Purpose: To figure out MPG, cost per mile, and cost per gallon
* 
*************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TripCalculator
{
    class Trip
    {

        // Displays instuctions and pupose of my Application
        public static void DisplayInstructions()
        {
            Console.WriteLine("The purpose of this program is to calculate the following: ");
            Console.WriteLine("Price Per Gallon: ");
            Console.WriteLine("Miles Per Gallon: ");
            Console.WriteLine("Cost Per Mile: ");
            Console.WriteLine("");
            Console.WriteLine("It will do so by calculating based on distance traveled, the total gas price");
            Console.WriteLine("and the total gallons used");
            Console.WriteLine(""); 
            Console.WriteLine("Press Any Key to Continue.");
            Console.ReadKey();
            Console.Clear();
        }
        
        public static void CalculateTrip()
        {
            // This is the CalculateTrip method

            double DistanceTraveled;
            double TotalGasPrice;
            double TotalGallons;
            double PricePerGallon;
            double MilesPerGallon;
            double CostPerMile;

            Console.WriteLine("How many miles did you travel?");
            DistanceTraveled = double.Parse(Console.ReadLine());

            Console.WriteLine("How much did you pay for gas?");
            TotalGasPrice = double.Parse(Console.ReadLine());

            Console.WriteLine("How many gallons of gas did you purchase?");
            TotalGallons = double.Parse(Console.ReadLine());

            PricePerGallon = TotalGasPrice / TotalGallons;
            MilesPerGallon = DistanceTraveled / TotalGallons;
            CostPerMile = TotalGasPrice / DistanceTraveled;

            Console.WriteLine("Distance Traveled = " + DistanceTraveled.ToString());
            Console.WriteLine("Total gas price = " + TotalGasPrice.ToString("C")); //converted double to currency
            Console.WriteLine("Total gallon = " + TotalGallons.ToString());
            Console.WriteLine("Total price per gallon:" + PricePerGallon.ToString("C")); //converted double to curency
            Console.WriteLine("Miles per gallon:" + MilesPerGallon.ToString());
            Console.WriteLine("Cost Per Mile:" + CostPerMile.ToString("C"));


        }

    }

}
